import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    proxy: {
        '/wukong': {
            target: 'https://xihe.mindspore.cn/api/v1/bigmodel/api/wukong',
            changeOrigin: true,
            rewrite: path => path.replace(/^\/wukong/, '')
        },
        "/chatglm":{
            target: 'https://open.bigmodel.cn/api/paas/v3/model-api/chatglm_pro/sse-invoke',
            changeOrigin: true,
            rewrite: path => path.replace(/^\/chatglm/, '')
        }
    }
  }
})
